<template>
    <div>
        <!-- 井眼准备数据 -->
        <div>
            <el-card style="height: 100%" class="card">
                <div slot="header">
                    <span>井眼准备</span>
                </div>
                <!-- 温度压力 -->
                <el-row class="dataform">
                    <div class="headstyle">温度压力</div>
                    <el-form ref="StratumtableData" :model="StratumtableData" label-width="120px">
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="井底温度(℃)">
                                    <el-input v-model="StratumtableData.bht"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="循环温度(℃)">
                                    <el-input v-model="StratumtableData.bct"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="井底压力(MPa)">
                                    <el-input v-model="StratumtableData.bhp"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item>
                                    <el-button type="primary" @click="onStratumSave">保存</el-button>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-row>
                <!-- 钻井液性能 -->
                <el-row class="dataform">
                    <div class="headstyle">钻井液性能</div>
                    <el-form ref="MudPropertytableData" :model="MudPropertytableData" label-width="120px">
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="密度(g/cm3)">
                                    <el-input v-model="MudPropertytableData.density"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="漏斗粘度(s)">
                                    <el-input v-model="MudPropertytableData.fv"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="失水(ml)">
                                    <el-input v-model="MudPropertytableData.lostwater"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="PH">
                                    <el-input v-model="MudPropertytableData.ph"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="初切(Pa)">
                                    <el-input v-model="MudPropertytableData.g1"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="终切(Pa)">
                                    <el-input v-model="MudPropertytableData.g2"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="含砂(%)">
                                    <el-input v-model="MudPropertytableData.sandcontent"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="含油(%)">
                                    <el-input v-model="MudPropertytableData.oilcontent"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="表观粘度(mPa.s)">
                                    <el-input v-model="MudPropertytableData.av"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="塑粘(mPa.s)">
                                    <el-input v-model="MudPropertytableData.pv"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="动切(Pa)">
                                    <el-input v-model="MudPropertytableData.yp"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="泥饼摩阻系数(Kf)">
                                    <el-input v-model="MudPropertytableData.kf"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="Ф600(rpm)">
                                    <el-input v-model="MudPropertytableData.rpm600"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="Ф300(rpm)">
                                    <el-input v-model="MudPropertytableData.rpm300"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="Ф200(rpm)">
                                    <el-input v-model="MudPropertytableData.rpm200"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="Ф100(rpm)">
                                    <el-input v-model="MudPropertytableData.rpm100"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="Ф6(rpm)">
                                    <el-input v-model="MudPropertytableData.rpm6"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="Ф3(rpm)">
                                    <el-input v-model="MudPropertytableData.rpm3"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6" :offset="6">
                                <el-form-item>
                                    <el-button type="primary" @click="onMudPropertySave">保存</el-button>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-row>
                <!-- 电测井径 -->
                <el-row class="dataform">
                    <div class="headstyle">电测井径</div>
                    <el-form ref="LogHoleDiametertableData" :model="LogHoleDiametertableData" label-width="120px">
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="平均井径(mm)">
                                    <el-input v-model="LogHoleDiametertableData.avgdiameter"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="井眼扩大率(%)">
                                    <el-input v-model="LogHoleDiametertableData.expandrate"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6" :offset="6">
                                <el-form-item>
                                    <el-button type="primary" @click="onLogHoleDiameterSave">保存</el-button>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-row>
                <!-- 地层承压能力 -->
                <el-row class="dataform">
                    <div class="headstyle">地层承压能力</div>
                    <el-form ref="StratumPressuretableData" :model="StratumPressuretableData" label-width="120px">
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="安全窗口">
                                    <el-input v-model="StratumPressuretableData.densitywindow"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <!-- 钻井液的当量循环密度 ECD Equivalent Circulating Density -->
                                <el-form-item label="ECD(g/cm3)">
                                    <el-input v-model="StratumPressuretableData.ecd"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="地层孔隙压力(MPa/km)">
                                    <el-input v-model="StratumPressuretableData.porepressure"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="地层漏失压力(MPa/km)">
                                    <el-input v-model="StratumPressuretableData.leakpressure"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="压稳密度(g/cm3)">
                                    <el-input v-model="StratumPressuretableData.stabledensity"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6" :offset="12">
                                <el-form-item>
                                    <el-button type="primary" @click="onStratumPressureSave">保存</el-button>
                                </el-form-item>
                            </el-col>
                        </el-row>
                       
                    </el-form>
                </el-row>
                <!-- 通井情况 -->
                <el-row class="dataform">
                    <div class="headstyle">通井情况</div>
                    <el-form ref="PigResulttableData" :model="PigResulttableData" label-width="120px">
                        <el-row>
                            <el-col :span="18">
                                <el-form-item label="通井组合">
                                    <el-input v-model="PigResulttableData.composition"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="18">
                                <el-form-item label="通井结果">
                                    <el-input v-model="PigResulttableData.result"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item>
                                    <el-button type="primary" @click="onPigResultSave">保存</el-button>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-row>
                <!-- 井漏复杂情况 -->
                <el-row class="dataTable">
                    <div class="headstyle">井漏复杂情况</div>
                    <div class="inputstyle">
                        <div>
                            <el-button type="success" @click="CreateLeakageProblem">新建</el-button>
                        </div>
                        <!-- <el-button type="success" @click="onSave">导入</el-button> -->
                        <!-- excel导入 -->
                        <div style="margin-left: 10px">
                            <el-upload class="upload-demo" :http-request="ImportLeakageProblem" :show-file-list="false" action="">
                                <el-button type="success">导入</el-button>
                            </el-upload>
                        </div>
                        <div style="margin-left: 10px">
                            <!-- 下载模板 -->
                            <el-button type="primary" @click="DownLoadModel1">模板下载</el-button>
                        </div>
                    </div>
                    <el-table
                        :data="tableData1"
                        border
                        style="width: 100%; font-size: 10px"
                        :max-height="tableHeight"
                        :header-row-style="rowStyle"
                        :header-cell-style="cellStyle"
                        :row-style="rowStyle"
                        :cell-style="cellStyle"
                        stripe
                    >
                        <el-table-column label="操作" width="210" align="center">
                            <template slot-scope="scope">
                                <el-button type="primary" size="mini" @click="handleEdit1(scope.$index, scope.row)">编辑</el-button>
                                <el-button type="danger" size="mini" @click="handleDelete1(scope.$index, scope.row)">删除</el-button>
                            </template>
                        </el-table-column>
                        <el-table-column align="center" prop="position" label="层位" />
                        <el-table-column align="center" prop="wellsection" label="井段" />
                        <el-table-column align="center" prop="rock" label="岩性" />
                        <el-table-column align="center" prop="category" label="显示类别" />
                        <el-table-column align="center" prop="desity" label="泥浆密度（g/cm3）" />
                        <el-table-column align="center" prop="velocity" label="漏速（m3/h）" />
                        <el-table-column align="center" prop="vol" label="漏失量（m3）" />
                        <el-table-column align="center" prop="result" label="处理结果" />
                    </el-table>
                </el-row>
                <!-- 显示页数1 -->
                <div class="pagination">
                    <el-pagination
                        background
                        layout="total, prev, pager, next"
                        :current-page="pageIdx1"
                        :page-size="pageSizes1"
                        :total="totalData1"
                        @current-change="handlePageChange1"
                    ></el-pagination>
                </div>
                <!-- 气侵复杂情况 -->
                <el-row class="dataTable">
                    <div class="headstyle">气侵复杂情况</div>
                    <div class="inputstyle">
                        <div>
                            <el-button type="success" @click="CreateGasCutProblem">新建</el-button>
                        </div>
                        <!-- <el-button type="success" @click="onSave">导入</el-button> -->
                        <!-- excel导入 -->
                        <div style="margin-left: 10px">
                            <el-upload class="upload-demo" :http-request="ImportGasCutProblem" :show-file-list="false" action="">
                                <el-button type="success">导入</el-button>
                            </el-upload>
                        </div>
                        <div style="margin-left: 10px">
                            <!-- 下载模板 -->
                            <el-button type="primary" @click="DownLoadModel2">模板下载</el-button>
                        </div>
                    </div>
                    <div class="inputDeep">
                        <el-table
                            :data="tableData2"
                            border
                            style="width: 100%; font-size: 10px"
                            :max-height="tableHeight"
                            :header-row-style="rowStyle"
                            :header-cell-style="cellStyle"
                            :row-style="rowStyle"
                            :cell-style="cellStyle"
                            stripe
                            :model="form"
                            ref="form"
                        >
                            <el-table-column label="操作" width="210" align="center">
                                <template slot-scope="scope">
                                    <el-button type="primary" size="mini" @click="handleEdit2(scope.$index, scope.row)">编辑</el-button>
                                    <el-button type="danger" size="mini" @click="handleDelete2(scope.$index, scope.row)">删除</el-button>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" prop="position" label="层位" />
                            <el-table-column align="center" prop="wellsection" label="井段" />
                            <el-table-column align="center" prop="rock" label="岩性" />
                            <el-table-column align="center" prop="category" label="显示类别" />
                            <el-table-column align="center" prop="desity" label="泥浆密度（g/cm3）" />
                            <el-table-column align="center" prop="hydrocarbon" label="全烃（%）" />
                            <el-table-column align="center" prop="c1" label="C1（%）" />
                            <el-table-column align="center" prop="interpretation" label="现场解释" />
                        </el-table>
                    </div>
                </el-row>
                <!-- 显示页数2 -->
                <div class="pagination">
                    <el-pagination
                        background
                        layout="total, prev, pager, next"
                        :current-page="pageIdx2"
                        :page-size="pageSizes2"
                        :total="totalData2"
                        @current-change="handlePageChange2"
                    ></el-pagination>
                </div>
                <!-- 井漏复杂情况--编辑弹出框 -->
                <el-dialog title="井漏复杂情况数据修改" :visible.sync="editVisible1" width="60%">
                    <el-form :model="form1" ref="form1" label-width="150px">
                        <el-col :span="12">
                            <el-form-item label="层位">
                                <el-input v-model="form1.position"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="井段">
                                <el-input v-model="form1.wellsection"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="岩性">
                                <el-input v-model="form1.rock"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="显示类别">
                                <el-input v-model="form1.category"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="泥浆密度（g/cm3）">
                                <el-input v-model="form1.desity"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="漏速（m3/h）">
                                <el-input v-model="form1.velocity"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="漏失量（m3）">
                                <el-input v-model="form1.vol"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="处理结果">
                                <el-input v-model="form1.result"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-form>
                    <span slot="footer" class="dialog-footer">
                        <el-button @click="editVisible1 = false">取 消</el-button>
                        <el-button type="primary" @click="saveEdit1" v-if="isNewData1">确 定</el-button>
                        <el-button type="primary" @click="saveEdit1" v-else>确 定</el-button>
                    </span>
                </el-dialog>
                <!-- 气侵复杂情况--编辑弹出框 -->
                <el-dialog title="气侵复杂情况数据修改" :visible.sync="editVisible2" width="60%">
                    <el-form :model="form2" ref="form1" label-width="150px">
                        <el-col :span="12">
                            <el-form-item label="层位">
                                <el-input v-model="form2.position"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="井段">
                                <el-input v-model="form2.wellsection"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="岩性">
                                <el-input v-model="form2.rock"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="显示类别">
                                <el-input v-model="form2.category"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="泥浆密度（g/cm3）">
                                <el-input v-model="form2.desity"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="全烃（%）">
                                <el-input v-model="form2.hydrocarbon"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="C1（%）">
                                <el-input v-model="form2.c1"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="现场解释">
                                <el-input v-model="form2.interpretation"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-form>
                    <span slot="footer" class="dialog-footer">
                        <el-button @click="editVisible2 = false">取 消</el-button>
                        <el-button type="primary" @click="saveEdit2" v-if="isNewData2">确 定</el-button>
                        <el-button type="primary" @click="saveEdit2" v-else>确 定</el-button>
                    </span>
                </el-dialog>
            </el-card>
        </div>
    </div>
</template>

<script>
import {
    SelectAllLeakageProblems,
    LeakageProblemUpdate,
    LeakageProblemAdd,
    LeakageProblemDelete
} from '../../../api/module/dataClassification/leakageProblem';
import {
    SelectAllGascutProblems,
    GascutProblemUpdate,
    GascutProblemAdd,
    GascutProblemDelete
} from '../../../api/module/dataClassification/gascutProblem';
import { importExcel, downTemplateExcel } from '../../../api/module/dataClassification/excel';
import {
    InsertOrUpdateStratum,
    InsertOrUpdateMudProperty,
    InsertOrUpdateLogHoleDiameter,
    InsertOrUpdateStratumPressureTest,
    InsertOrUpdatePigResult,
    FindStratumByCondition,
    FindMudPropertyByCondition,
    FindLogHoleDiameterByCondition,
    FindStratumPressureTestByCondition,
    FindPigResultByCondition
} from '../../../api/module/dataClassification/WellPreparizatation';
export default {
    data() {
        return {
            wellstructureid: localStorage.getItem('wellstructureid'),
            wellData: {},
            StratumtableData: {
                bct: null,
                bhp: null,
                bht: null,
                bitsize: localStorage.getItem('bitsize'),
                caselevel: '',
                casesize: localStorage.getItem('casesize'),
                coefficient: null,
                no: localStorage.getItem('no'),
                stratumid: null,
                wellname: localStorage.getItem('wellname')
            }, //温度压力数据
            MudPropertytableData: {
                av: null,
                bitsize: localStorage.getItem('bitsize'),
                caselevel: '',
                casesize: localStorage.getItem('casesize'),
                density: null,
                fv: null,
                g1: null,
                g2: null,
                kf: null,
                lostwater: null,
                mudpropertyid: null,
                no: localStorage.getItem('no'),
                oilcontent: null,
                ph: null,
                pv: null,
                rpm100: null,
                rpm200: null,
                rpm3: null,
                rpm300: null,
                rpm6: null,
                rpm600: null,
                sandcontent: null,
                sp10m: null,
                sp10s: null,
                wellname: localStorage.getItem('wellname'),
                yp: null
            }, //钻井液性能
            LogHoleDiametertableData: {
                avgdiameter: null,
                bitsize: localStorage.getItem('bitsize'),
                caselevel: '',
                casesize: localStorage.getItem('casesize'),
                expandrate: null,
                logholediameterid: null,
                no: localStorage.getItem('no'),
                wellname: localStorage.getItem('wellname')
            }, //电测井径
            StratumPressuretableData: {
                bearpressure: null,
                bitsize: localStorage.getItem('bitsize'),
                caselevel: '',
                casesize: localStorage.getItem('casesize'),
                densitywindow: '',
                ecd: null,
                leakpressure: null,
                no: localStorage.getItem('no'),
                porepressure: null,
                stratumpressuretestid: null,
                wellname: localStorage.getItem('wellname'),
                stabledensity: null
            }, //地层承压实验
            PigResulttableData: {
                bitsize: localStorage.getItem('bitsize'),
                caselevel: '',
                casesize: localStorage.getItem('casesize'),
                composition: '',
                no: localStorage.getItem('no'),
                pigresultid: null,
                result: '',
                wellname: localStorage.getItem('wellname')
            }, //通井结果数据
            tableData1: [], //井漏复杂情况数据
            tableData2: [],
            //分页导航1
            pageIdx1: 1,
            pageSizes1: 10,
            totalData1: 0,
            //分页导航2
            pageIdx2: 1,
            pageSizes2: 10,
            totalData2: 0,
            //查询行的数据
            searchModel: {
                //查询部分默认的绑定值
                wellName: localStorage.getItem('wellname'), //井名
                wellType: '', //井型
                wellCategory: '', //井别
                startDrillDate: '', //开钻日期
                endDrillDate: '', //完钻日期
                currentPage: 1, //当前页
                pageSize: 10, //页大小
                //井漏复杂情况
                currentPage1: 1, //当前页
                pageSize1: 10, //页大小
                //气侵复杂情况
                currentPage2: 1, //当前页
                pageSize2: 10 //页大小
            },
            condition: {
                bitsize: localStorage.getItem('bitsize'),
                casesize: localStorage.getItem('casesize'),
                no: localStorage.getItem('no'),
                wellname: localStorage.getItem('wellname')
            },
            //table展示数据（样式）
            tableHeight: localStorage.getItem('tableHeight'),
            rowStyle: { height: '30px' },
            cellStyle: {
                padding: 0
            },
            display: {
                readonly: true
            },
            form: {},
            form1: {},
            form2: {},
            editVisible1: false,
            editVisible2: false,
            isNewData1: false,
            isNewData2: false
        };
    },
    created() {
        this.FindStratumByCondition();
        this.FindMudPropertyByCondition();
        this.FindLogHoleDiameterByCondition();
        this.FindStratumPressureTestByCondition();
        this.FindPigResultByCondition();
        // console.log(this.condition)
        this.SelectAllLeakageProblems();
        this.SelectAllGascutProblems();
    },
    mounted() {},
    methods: {
        //查询温度压力数据
        FindStratumByCondition() {
            FindStratumByCondition(this.wellstructureid).then((res) => {
                if (res.data == null) {
                } else {
                    this.StratumtableData = res.data;
                }
            });
        },
        //查询钻井液性能数据
        FindMudPropertyByCondition() {
            FindMudPropertyByCondition(this.wellstructureid).then((res) => {
                
                if (res.data == null) {
                } else {
                    this.MudPropertytableData = res.data;
                }
                console.log("钻井液性能数据res：",res)
            }).catch(err=>{
                console.log("钻井液性能数据s失败")
            });
        },
        //查询电测井径数据
        FindLogHoleDiameterByCondition() {
            FindLogHoleDiameterByCondition(this.wellstructureid).then((res) => {
                if (res.data == null) {
                } else {
                    this.LogHoleDiametertableData = res.data;
                }
            });
        },
        //查询地层承压实验数据
        FindStratumPressureTestByCondition() {
            FindStratumPressureTestByCondition(this.wellstructureid).then((res) => {
                if (res.data == null) {
                } else {
                    this.StratumPressuretableData = res.data;
                }
            });
        },
        //查询通井结果数据
        FindPigResultByCondition() {
            FindPigResultByCondition(this.wellstructureid).then((res) => {
                if (res.data == null) {
                } else {
                    this.PigResulttableData = res.data;
                }
                console.log("通井数据查询成功",res)
            }).catch(err=>{
                console.log("通井数据查询失败err")
            });
        },
        //修改温度压力数据
        InsertOrUpdateStratum() {
            InsertOrUpdateStratum(this.wellstructureid, this.StratumtableData).then((res) => {
                console.log(res);
                this.$message.success('保存成功！');
                this.FindStratumByCondition();
            });
        },
        //修改钻井液性能
        InsertOrUpdateMudProperty() {
            InsertOrUpdateMudProperty(this.wellstructureid, this.MudPropertytableData).then((res) => {
                console.log(res);
                this.$message.success('保存成功！');
                this.FindMudPropertyByCondition();
            });
        },
        //修改电测井径数据
        InsertOrUpdateLogHoleDiameter() {
            InsertOrUpdateLogHoleDiameter(this.wellstructureid, this.LogHoleDiametertableData).then((res) => {
                console.log(res);
                this.$message.success('保存成功！');
                this.FindLogHoleDiameterByCondition();
            });
        },
        //修改地层承压能力数据
        InsertOrUpdateStratumPressureTest() {
            InsertOrUpdateStratumPressureTest(this.wellstructureid, this.StratumPressuretableData).then((res) => {
                console.log(res);
                this.$message.success('保存成功！');
                this.FindStratumPressureTestByCondition();
            });
        },
        //修改通井情况数据
        InsertOrUpdatePigResult() {
            InsertOrUpdatePigResult(this.wellstructureid, this.PigResulttableData).then((res) => {
                console.log(res);
                this.$message.success('保存成功！');
                this.FindPigResultByCondition();
            });
        },
        //保存温度压力数据
        onStratumSave() {
            this.InsertOrUpdateStratum();
        },
        //保存钻井液性能数据
        onMudPropertySave() {
            this.InsertOrUpdateMudProperty();
        },
        //保存电测井径数据
        onLogHoleDiameterSave() {
            this.InsertOrUpdateLogHoleDiameter();
        },
        //保存地层承压能力数据
        onStratumPressureSave() {
            this.InsertOrUpdateStratumPressureTest();
        },
        //保存通井情况数据
        onPigResultSave() {
            this.InsertOrUpdatePigResult();
        },
        //查询（表格）-- 井漏复杂情况
        SelectAllLeakageProblems() {
            SelectAllLeakageProblems(this.condition, this.searchModel.currentPage1, this.searchModel.pageSize1).then((res) => {
                this.tableData1 = res.data.records;
                this.totalData1 = res.data.total;
            });
        },
        //修改（表格--行数据）-- 井漏复杂情况
        LeakageProblemUpdate() {
            LeakageProblemUpdate(this.form1).then((res) => {
                console.log(res);
                this.$message.success('井漏复杂情况修改成功！');
            });
        },
        //新增（表格--行数据）-- 井漏复杂情况
        LeakageProblemAdd() {
            LeakageProblemAdd(this.form1).then((res) => {
                console.log(res);
                this.$message.success('井漏复杂情况新增成功！');
                //查询新增
                this.SelectAllLeakageProblems();
            });
        },
        //删除（表格--行数据）-- 井漏复杂情况
        LeakageProblemDelete(id) {
            LeakageProblemDelete(id).then((res) => {
                console.log(res);
                this.$message.success('井漏复杂情况删除成功！');
            });
        },
        //查询（表格）-- 气侵复杂情况
        SelectAllGascutProblems() {
            SelectAllGascutProblems(this.condition, this.searchModel.currentPage2, this.searchModel.pageSize2).then((res) => {
                this.tableData2 = res.data.records;
                this.totalData2 = res.data.total;
            });
        },
        //修改（表格--行数据）-- 气侵复杂情况
        GascutProblemUpdate() {
            GascutProblemUpdate(this.form2).then((res) => {
                console.log(res);
                this.$message.success('气侵复杂情况修改成功！');
            });
        },
        //新增（表格--行数据）-- 气侵复杂情况
        GascutProblemAdd() {
            GascutProblemAdd(this.form2).then((res) => {
                console.log(res);
                this.$message.success('气侵复杂情况新增成功！');
                //查询气侵
                this.SelectAllGascutProblems();
            });
        },
        //删除（表格--行数据）-- 气侵复杂情况
        GascutProblemDelete(id) {
            GascutProblemDelete(id).then((res) => {
                console.log(res);
                this.$message.success('气侵复杂情况删除成功！');
            });
        },
        //新增--井漏复杂情况
        CreateLeakageProblem() {
            this.editVisible1 = true;
            this.isNewData1 = true;
            this.form1 = {
                bitsize: localStorage.getItem('bitsize'),
                caselevel: '',
                casesize: localStorage.getItem('casesize'),
                category: '',
                desity: null,
                leakageproblemid: null,
                no: localStorage.getItem('no'),
                position: '',
                result: '',
                rock: '',
                velocity: null,
                vol: null,
                wellname: localStorage.getItem('wellname'),
                wellsection: ''
            };
        },
        //编辑--井漏复杂情况
        handleEdit1(index, row) {
            this.editVisible1 = true;
            this.isNewData1 = false;
            this.form1 = row;
        },
        //保存--井漏复杂情况
        saveEdit1() {
            this.editVisible1 = false;
            //保存操作
            if (this.isNewData1) {
                //新增操作
                this.LeakageProblemAdd();
                this.SelectAllLeakageProblems();
            } else {
                //更新操作
                this.LeakageProblemUpdate();
            }
        },
        //删除--井漏复杂情况
        handleDelete1(index, row) {
            // 二次确认删除
            this.$confirm('确定要删除吗？', '提示', {
                type: 'warning'
            })
                .then(() => {
                    // this.$message.success('删除成功')
                    this.tableData1.splice(index, 1);
                    //删除数据库数据操作
                    this.LeakageProblemDelete(row.leakageproblemid);
                })
                .catch(() => {});
        },
        //新增--气侵复杂情况
        CreateGasCutProblem() {
            this.editVisible2 = true;
            this.isNewData2 = true;
            this.form2 = {
                bitsize: localStorage.getItem('bitsize'),
                c1: '',
                caselevel: '',
                casesize: localStorage.getItem('casesize'),
                category: '',
                desity: null,
                gascutproblemid: null,
                hydrocarbon: '',
                interpretation: '',
                no: localStorage.getItem('no'),
                position: '',
                rock: '',
                wellname: localStorage.getItem('wellname'),
                wellsection: ''
            };
        },
        //编辑--气侵复杂情况
        handleEdit2(index, row) {
            this.editVisible2 = true;
            this.isNewData2 = false;
            this.form2 = row;
        },
        //保存--气侵复杂情况
        saveEdit2() {
            this.editVisible2 = false;
            //保存操作
            if (this.isNewData2) {
                //新增操作
                this.GascutProblemAdd();
                this.SelectAllGascutProblems();
            } else {
                //更新操作
                this.GascutProblemUpdate();
            }
        },
        //删除--气侵复杂情况
        handleDelete2(index, row) {
            // 二次确认删除
            this.$confirm('确定要删除吗？', '提示', {
                type: 'warning'
            })
                .then(() => {
                    // this.$message.success('删除成功')
                    this.tableData2.splice(index, 1);
                    //删除数据库数据操作
                    this.GascutProblemDelete(row.gascutproblemid);
                })
                .catch(() => {});
        },
        //分页导航1
        handlePageChange1(page) {
            this.pageIdx1 = page;
            this.searchModel.currentPage1 = page;
            this.SelectAllLeakageProblems();
        },
        //分页导航2
        handlePageChange2(page) {
            this.pageIdx2 = page;
            this.searchModel.currentPage2 = page;
            this.SelectAllGascutProblems();
        },
        //excel导入1
        ImportLeakageProblem(item) {
            const loading = this.$loading({
                lock: true,
                text: '数据导入中...',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
            const formData = new FormData();
            formData.append('file', item.file);
            importExcel(formData, 'LeakageProblem')
                .then((res) => {
                    console.log('excel导入...');
                   
                    this.SelectAllLeakageProblems();
                    loading.close()
                     this.$message.success("数据导入成功")
                })
                .catch((err) => {
                    console.log(err);
                    loading.close()
                    this.$message.warning("数据导入失败")
                });
        },
        //excel导入2
        ImportGasCutProblem(item) {
            const loading = this.$loading({
                lock: true,
                text: '数据导入中...',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
            const formData = new FormData();
            formData.append('file', item.file);
            importExcel(formData, 'GasCutProblem')
                .then((res) => {
                    console.log('excel导入...');
                   
                    this.SelectAllGascutProblems();
                    loading.close()
                    this.$message.success("数据导入成功")
                })
                .catch((err) => {
                    console.log(err);
                    loading.close()
                    this.$message.warning("数据导入失败")
                });
        },
        onSave() {},
        //下载模板1
        DownLoadModel1() {
            //下载excel模板
            downTemplateExcel('LeakageProblem').then((res) => {
                console.log(res);
                if (!res) {
                    return;
                }
                const link = document.createElement('a');
                let blob = new Blob([res]);
                link.style.display = 'none';
                link.href = URL.createObjectURL(blob);
                link.setAttribute('download', '井漏（LeakageProblem）.xlsx');
                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link);
            });
        },
        //下载模板2
        DownLoadModel2() {
            //下载excel模板
            downTemplateExcel('GasCutProblem').then((res) => {
                console.log(res);
                if (!res) {
                    return;
                }
                const link = document.createElement('a');
                let blob = new Blob([res]);
                link.style.display = 'none';
                link.href = URL.createObjectURL(blob);
                link.setAttribute('download', '气侵（GasCutProblem）.xlsx');
                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link);
            });
        }
    }
};
</script>

<style scoped>
.card >>> .el-card__body {
    padding: 5px;
}
.card >>> .el-card__header {
    font-size: 17px;
    padding: 5px 10px;
    /* padding: 5px 10px !important; */
    height: 40px;
    line-height: 30px;
    background-color: #eef0f6;
}
.dataform {
    width: 97%;
    margin-left: 20px;
    margin-top: 10px;
}
.dataTable {
    width: 97%;
    margin-left: 20px;
    margin-top: 10px;
    margin-bottom: 30px;
}
.headstyle {
    height: 25px;
    font-size: 14px;
    padding: 5px 10px;
    background-color: hsl(225, 39%, 48%);
    color: white;
}
form {
    margin-top: 10px;
}

/* 利用穿透，设置input边框隐藏 */
.inputDeep >>> .el-input__inner {
    border: 0;
}

.inputstyle {
    margin-left: 13px;

    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.upload-demo >>> .el-upload--text {
    width: 57px;
    height: 50px;
    border-radius: 0px;
    border: none;
    display: flex;
    align-items: center;
}
</style>